<?php

namespace App\View\Components;

use App\Service\AuthService;
use App\Service\OrgService;
use Illuminate\Http\Request;
use Illuminate\View\Component;

class OrgSelect extends Component {
    public $orgs=[];
    public $select="";
    public $name = "";
    public $width = "";
    /**
     * Create a new component instance.
     *
     * @return void
     */
    public function __construct($select="",$name="",$width="100%")
    {
        $this->orgs = json_encode((new OrgService())->orgList([]));
        $this->select=$select;
        $this->name=$name;
        $this->width=$width;
    }

    /**自定义方法*/
    /**
     * 给blade组件模板添加方法
     */
    public function customFunction($test="我是参数"): string
    {
        return $test;
    }

    /**
     * Get the view / contents that represent the component.
     *
     * @return \Illuminate\Contracts\View\View|\Closure|string
     */
    public function render() {
        return view('components.org-select');
    }
}
